<?php
header("Content-type:application/vnd.ms-excel"); 
header("Content-Disposition:attachment; filename=test_data.xls");
define('Copyright', '作者QQ:765858558');
 define('ROOT_PATH', $_SERVER["DOCUMENT_ROOT"].'/');
include_once ROOT_PATH.'classed/DeBe.php';
include_once ROOT_PATH.'functioned/peizhi.php';
 
if(is_array($_GET)&& count($_GET)>0)//判断是否有Get参数 
{ 
if(isset($_GET["type"]) && isset($_GET["qishu"]) && isset($_GET["pass"]))//判断所需要的参数是否存在，isset用来检测变量是否设置，返回true or false 
{ 
$type=$_GET["type"]; 
$qishu=$_GET["qishu"]; 
$pass=$_GET["pass"]; 
if($bfpass!=$pass)
{
echo "密码错误！";
exit;
}
$typeid="";
if($type=="1")
{
$typeid="廣東快樂十分";
}else if($type=="2")
{
$typeid="重慶時時彩";
}else if($type=="9")
{
$typeid="重慶幸運農場";
}else if($type=="4")
{
$typeid="幸運飛艇";
}else if($type=="6")
{
$typeid="北京賽車(PK10)";
}else if($type=="7")
{
$typeid="江苏快三";
}else if($type=="8")
{
$typeid="快樂8(雙盤)";
}else if($type=="3")
{
$typeid="全天五分彩";
}else if($type=="10")
{
$typeid="新疆时时彩";
}else if($type=="11")
{
$typeid="天津时时彩";
}


$db = new DB();
  //查询出最新开奖期数
 //广东快乐十分
$sql="SELECT * FROM `g_zhudan`  where g_qishu='".$qishu."' and g_type='".$typeid."'";
$res= $db->query($sql, 1);

/*foreach($result as $data){
echo $data['g_mingxi_1'];
}*/
  
 /** $sql = "SELECT * FROM " .$ecs->table('member'). " ";
$res = $db->Execute($sql);
header("Content-type:application/vnd.ms-excel"); 
header("Content-Disposition:attachment; filename=test_data.xls");*/
echo 'ID'.chr(9);
echo '用户名'.chr(9);
echo '下注时间'.chr(9);
echo '彩种名'.chr(9);
echo '期数'.chr(9);
echo '明细1'.chr(9);
echo '明细*'.chr(9);
echo '明细2'.chr(9);
echo '赔率'.chr(9);
echo '下注金额'.chr(9);
echo chr(13);

foreach($res as $row)
{
//输出到xls
     echo $row['g_id'].chr(9);
     echo $row['g_nid'].chr(9);
     echo $row['g_date'].chr(9);
     echo $row['g_type'].chr(9);
     echo $row['g_qishu'].chr(9);
     echo $row['g_mingxi_1'].chr(9);
     echo $row['g_mingxi_1_str'].chr(9);
     echo $row['g_mingxi_2'].chr(9);
     echo $row['g_odds'].chr(9);
     echo $row['g_jiner'].chr(9);
     echo chr(13);
}


} 
} 
//echo $qishu;

?>